package com.yc.projects.pro4_mysql;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.sql.SQLException;
import java.util.List;

public class App_main {
    public static void main(String[] args) throws SQLException {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
        DruidDataSource ds = (DruidDataSource) context.getBean("druidDataSource");
        System.out.println(ds);
        DruidPooledConnection connection = ds.getConnection();
        System.out.println(connection);
        BookBiz biz = context.getBean(BookBiz.class);
        List<BookBean> book = biz.findBook();
        System.out.println(book);
    }
}
